package com.wb3.meta.api.core.controller;

import com.wb3.meta.api.core.service.WorldInfoService;
import com.wb3.meta.api.core.vo.ReqWorldInfoVo;
import com.wb3.meta.common.annotation.NoPermission;
import com.wb3.meta.common.plugin.BaseResultController;
import com.wb3.meta.common.pojo.ResultT;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "世界-信息接口")
@RequestMapping("base/world/info/")
public class WorldInfoController extends BaseResultController<ReqWorldInfoVo> {

    @Autowired
    private WorldInfoService worldInfoService;
    /**
     * 列表接口
     *
     * @param reqWorldInfoVo
     */
    @Override
    @ApiOperation("列表接口")
    @GetMapping("list")
    public ResultT list(ReqWorldInfoVo reqWorldInfoVo) {

        return worldInfoService.getModelMapPage(reqWorldInfoVo);
    }


    /**
     * 明细接口
     *
     * @param reqWorldInfoVo
     */
    @Override
    @ApiOperation("详情接口")
    @GetMapping("detail")
    public ResultT detail(ReqWorldInfoVo reqWorldInfoVo) {
        return worldInfoService.getModelMapById(reqWorldInfoVo.getId());
    }

    /**
     * 新增or更新接口
     *
     * @param reqWorldInfoVo
     */
    @NoPermission
    @Override
    @ApiOperation("更新接口")
    @PostMapping("update")
    public ResultT saveOrUpdate(@RequestBody ReqWorldInfoVo reqWorldInfoVo) {
        return worldInfoService.saveOrUpdate(reqWorldInfoVo);
    }

    /**
     * 删除接口
     *
     * @param reqWorldInfoVo
     */
    @NoPermission
    @Override
    @ApiOperation("删除接口")
    @PostMapping("delete")
    public ResultT delete(@RequestBody ReqWorldInfoVo reqWorldInfoVo) {
        return worldInfoService.delete(reqWorldInfoVo);
    }
}
